<script setup lang="ts">
import { useRouter } from 'vue-router';
import { onMounted, ref } from 'vue';
import { getIcon } from '@/api/assets/assets';

const router = useRouter()

const backgroundImage = ref<string>('')

const handleExperienceClick = () => {
  router.push('/user/homepagesquare')
}

const handleInnovationClick = () => {
  router.push('/user/dachuang')
}
const fetchIcon = async () => {
  try {
    const data = await getIcon(['1111.png'])
    backgroundImage.value = `url(${data['1111.png']})`
  }
  catch (error) {
    console.error('API 调用错误:', error)
  }
}

onMounted(() => {
  fetchIcon()
})
</script>

<template>
  <div class="homeBanner" :style="{ backgroundImage }">
    <div class="homeBannerContent">
      <div class="textContent">
        <h1 class="title">
          智链iLink
        </h1>
        <p class="subtitle">
          创新无界，智链未来
        </p>
        <p class="description">
          <span class="blackText">大模型</span>
          <span class="blueText">创新实践平台</span>
        </p>
      </div>
      <div class="buttons">
        <button class="experienceButton" @click="handleExperienceClick">
          立即体验
        </button>
        <button class="innovationButton" @click="handleInnovationClick">
          创新广场
        </button>
      </div>
    </div>
    <div class="bottomFade" />
  </div>
</template>

<style scoped>
.homeBanner {
  width: 103% !important;
  min-height: 800px;
  background-size: cover;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  opacity: 1;
}

.homeBannerContent {
  position: absolute;
  top: 231px;
  /* 设置整体位置 */
  left: 360px;
  text-align: left;
}

.textContent {
  width: 273px;
  height: auto;
  gap: 2px;
  opacity: 1;
}

.title {
  font-family: 'Alimama ShuHeiTi', sans-serif;
  font-size: 60px;
  font-weight: 700;
  line-height: 78.46px;
  background: linear-gradient(90deg, #4B79DB 0%, #3BBAFC 100%);
  -webkit-background-clip: text;
  color: transparent;
  white-space: nowrap;
  /* 确保标题在同一行 */
}

.subtitle {
  font-family: 'Alimama ShuHeiTi', sans-serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 34.33px;
  background: linear-gradient(180deg, #4B79DB 0%, #3BBAFC 100%);
  -webkit-background-clip: text;
  color: transparent;
  margin-bottom: 20px;
}

.description {
  width: 252px;
  height: auto;
  font-family: 'Alimama ShuHeiTi', sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 24.52px;
}

.blackText {
  color: rgba(17, 17, 17, 0.5);
  background: none;
}

.blueText {
  color: #417eff;
  background: none;
}

.buttons {
  display: flex;
  gap: 50px;
  margin-top: 20px;
}

.experienceButton {
  width: 228px;
  height: 72px;
  padding: 10px 0;
  border-radius: 6px 20px 6px 20px;
  background: linear-gradient(100.12deg, #4B79DB 0%, #3BBAFC 100%);
  box-shadow: 0px 4px 24px 0px rgba(84, 193, 255, 0.56);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  transition: opacity 0.3s;
}

.experienceButton:hover {
  opacity: 0.8;
}

.innovationButton {
  width: 228px;
  height: 72px;
  padding: 10px 0;
  border-radius: 6px 20px 6px 20px;
  background: rgba(255, 255, 255, 0.6);
  border: 2.5px solid;
  border-image-source: linear-gradient(90deg, #4B79DB 0%, #3BBAFC 100%);
  box-shadow: 0px 4px 13px 0px rgba(84, 193, 255, 0.56);
  color: #4B79DB;
  font-size: 18px;
  cursor: pointer;
  transition: opacity 0.3s;
}

.innovationButton:hover {
  opacity: 0.8;
}

.bottomFade {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 123px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #FFFFFF 100%);
  opacity: 1;
}
</style>
